
package com.mybatis.generator;

import com.mybatis.generator.core.Context;
import com.mybatis.generator.core.FreemarkerUtils;
import com.mybatis.generator.core.Table;


public class SqlMapGenerator {

	private static final String TEMPLATE_NAME = "freemaker-sqlmap";

	public static void process(Context ctx, Table table) throws Exception {
		StringBuilder sb = new StringBuilder(ctx.getSqlmap());
		sb.append("/");
		sb.append(table.getMapperName()).append(".xml");
		FreemarkerUtils.write(sb.toString(),
				FreemarkerUtils.process(TEMPLATE_NAME, table));
	}
	
}
